package com.example.dilidili_ting.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.dilidili_ting.MainActivity;
import com.example.dilidili_ting.R;
import com.example.dilidili_ting.utils.SharedPreferencesUtilsTing;

public class hyActivityTing extends AppCompatActivity {

    private Button loginBtn_ting;
    private Button registerBtn_ting;
    private TextView tvForgerPassword_ting;
    private TextView tvSkip_ting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hy_ting);
        getisLogin();
        initView();
    }

    private void getisLogin() {
        if(SharedPreferencesUtilsTing.readLoginStatus(this)){
            // TODO: 2021/6/15 跳转到首页
            hyActivityTing.this.finish();
            Intent intent = new Intent(hyActivityTing.this, MainActivity.class);
            startActivity(intent);
        }
    }

    private void initView() {
        loginBtn_ting=findViewById(R.id.login_btn_ting);
        registerBtn_ting=findViewById(R.id.register_btn_ting);
        tvForgerPassword_ting=findViewById(R.id.tv_forget_password_ting);
        tvSkip_ting=findViewById(R.id.tv_skip_ting);

        loginBtn_ting.setOnClickListener(new View.OnClickListener() {
            @Override
            // TODO: 2021/6/15 跳转到登录页面
            public void onClick(View v) {
                Intent intent=new Intent(hyActivityTing.this, loginActivityTing.class);
                startActivity(intent);
            }
        });

        registerBtn_ting.setOnClickListener(new View.OnClickListener() {
            @Override
            // TODO: 2021/6/15 跳转到注册页面
            public void onClick(View v) {
                Intent intent=new Intent(hyActivityTing.this, regActivityTing.class);
                startActivity(intent);
            }
        });

        tvForgerPassword_ting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO: 2021/6/15 跳转到找回密码页面
                Intent intent = new Intent(hyActivityTing.this, FindPswActivityTing.class);
                startActivity(intent);
            }
        });

        tvSkip_ting.setOnClickListener(new View.OnClickListener() {
            @Override
            // TODO: 2021/6/15 跳转到首页
            public void onClick(View v) {
                Intent intent=new Intent(hyActivityTing.this, MainActivity.class);
                startActivity(intent);
            }
        });
    }
}